<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
<html>
<head>
                                       
  <meta http-equiv="content-type"
 content="text/html; charset=ISO-8859-1">
                                       
  <meta name="author" content="Dan Shafer">
  <title>Message Dialog</title>
   
</head>
  <body>
                   
<h1>Message Dialog</h1>
          <img height="119" width="185" alt="Message Dialog Sample"
 src="images/dialogsfig8.png">
           <br>
          <br>
                   
<h2>Creating the Dialog</h2>
          Create a Message Dialog by calling dialog.messageDialog    with 
 the three required and two optional arguments shown in the following table.<br>
          <br>
                   
<table cellpadding="2" cellspacing="2" border="1" width="80%">
            <tbody>
              <tr>
                 <td valign="top"><b>Argument</b><br>
                </td>
                <td valign="top"><b>Data type/notes</b><br>
                </td>
              </tr>
              <tr>
                <td valign="top">self<br>
                 </td>
                <td valign="top">the window (background) that is the parent 
 for   the  dialog<br>
                </td>
              </tr>
              <tr>
        <td valign="top">message<br>
        </td>
        <td valign="top">quoted string displayed as the message in the dialog<br>
        </td>
      </tr>
              <tr>
                <td valign="top">title<br>
                </td>
                <td valign="top">quoted string displayed in title bar of
dialog<br>
                 </td>
              </tr>
      <tr>
                <td valign="top">OPTIONAL icon<br>
        </td>
                <td valign="top">You may optionally include one of the defined
 wxPython constants defining an icon to be displayed in the message dialog.
 By default, PythonCard displays the "info" icon shown in the figure above.
 See below for details.<br>
        </td>
              </tr>
     <tr>
       <td valign="top">OPTIONAL buttons<br>
       </td>
       <td valign="top">You may optionally include one of the defined exPython 
constants defining one or more button names to be displayed in the Message 
dialog. By default, PythonCard displays the "OK" and "Cancel" buttons shown 
in the figure above. See below for details.<br>
<br><b>Note that as of PythonCard 0.8 the fourth and fifth args have been combined, so you should use | (binary or) to join them (e.g. wx.ICON_EXCLAMATION | wx.OK).</b>
       </td>
     </tr>
                                                    
  </tbody>          
</table>
           <br>
          <b>Example:<br>
          <br>
          </b>Above dialog was created with this line of code:<br>
          <br>
         <code>result = dialog.messageDialog(self, 'a message', 'a title')</code><br>
 <br>
 To add an icon other than the default "info" icon to the Message Dialog, 
provide the fourth argument, which can be any of the values shown in the following
table:<br>
 <br>
 
<table cellpadding="2" cellspacing="2" border="1" width="80%">
   <tbody>
     <tr>
       <td valign="top"><b>Constant</b><br>
       </td>
       <td valign="top"><b>Description of Icon</b><br>
       </td>
     </tr>
     <tr>
       <td valign="top">wx.ICON_EXCLAMATION<br>
       </td>
       <td valign="top">Exclamation point<br>
       </td>
     </tr>
     <tr>
       <td valign="top">wx.ICON_HAND <br>
       </td>
       <td valign="top">Hand, or error, icon<br>
       </td>
     </tr>
     <tr>
       <td valign="top">wx.ICON_ERROR<br>
       </td>
       <td valign="top">Same as ICON_HAND<br>
       </td>
     </tr>
     <tr>
       <td valign="top">wx.ICON_QUESTION<br>
       </td>
       <td valign="top">Question mark<br>
       </td>
     </tr>
     <tr>
       <td valign="top">wx.ICON_INFORMATION <br>
       </td>
       <td valign="top">Small "i" icon, the default icon<br>
       </td>
     </tr>
   
  </tbody> 
</table>
 <br>
 Note that there are user interface guidelines for the appropriate use of 
these icons. It is generally a good idea to use them in the standard ways 
users expect to encounter them.<br>
 <br>
 You can also cause the Message Dialog to display buttons labeled other than 
"OK" and "Cancel" by providing one of the constants in the following table 
as the optional fifth argument to the dialog.messageDialog method:<br>
 <br>
 
<table cellpadding="2" cellspacing="2" border="1" width="80%">
   <tbody>
     <tr>
       <td valign="top"><b>Constant</b><br>
       </td>
       <td valign="top"><b>Button Labels</b><br>
       </td>
     </tr>
     <tr>
       <td valign="top">wx.OK<br>
       </td>
       <td valign="top">OK Button<br>
       </td>
     </tr>
     <tr>
       <td valign="top">wx.CANCEL<br>
       </td>
       <td valign="top">Cancel Button<br>
       </td>
     </tr>
     <tr>
       <td valign="top">wx.YES_NO<br>
       </td>
       <td valign="top">Two buttons, one labeled "Yes" and the other labeled 
"No"<br>
       </td>
     </tr>
     <tr>
       <td valign="top">wx.YES_DEFAULT<br>
       </td>
       <td valign="top">If you supply BUTTON_YES_NO as the button constant, 
you can optionally include this constant to cause the "Yes" button to be the
default button. Since "Yes" is always the default button unless you change 
it, this constant is probably not of much use.<br>
       </td>
     </tr>
     <tr>
       <td valign="top">wx.NO_DEFAULT<br>
       </td>
       <td valign="top">If you supply wx.YES_NO as the button constant, 
you can optionally include this constant to cause the "No" button to be the 
default button.<br>
       </td>
     </tr>
   
  </tbody> 
</table>
 <br>
                    
<h2>Interacting With the Dialog</h2>
          The messageDialog component returns two values, stored as elements
     of the Python dictionary called "results" returned by all PythonCard
dialogs.     These results are as shown in the following table.<br>
          <br>
                   
<table cellpadding="2" cellspacing="2" border="1" width="80%">
            <tbody>
              <tr>
                <td valign="top"><b>Name of value</b><br>
                 </td>
                <td valign="top"><b>Description</b><br>
                </td>
              </tr>
              <tr>
                <td valign="top">accepted<br>
                </td>
                <td valign="top">True = user clicked OK<br>
           False = user clicked Cancel<br>
                </td>
              </tr>
              <tr>
                <td valign="top">returnedString<br>
                </td>
                <td valign="top">string containing 'Ok' or 'Cancel' reflecting
 which button the user clicked to dismiss the Message dialog<br>
                 </td>
              </tr>
                                       
  </tbody>          
</table>
          <br>
         <b>Example:<br>
         <br>
      </b>   The sample dialog shown at the top of this page returns the
following    results:<b><br>
         <br>
         </b>accepted: True<br>
  returnedString: Ok<br>
         <br>
         <br>
          &nbsp; <br>
          <br>
          <br>
            <br>
        <br>
        <br>
 
</body>
</html>
